<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		
		<script>
			"use strict"
			
			// 小试牛刀
			function* myGenerator(){
				console.log("开始执行")
				let result = yield "hello"
				console.log(result)
				console.log("暂停后, 再次执行")
				let result2 = yield "generator"
				console.log(result2)
				console.log("遍历完毕")
				return "返回的结果"
			}
			
			let MG = myGenerator()  // 返回的是指针对象
			console.log(MG)
			console.log(MG.next())
			console.log(MG.next())
			console.log(MG.next("aaaaaaaaaaaaa"))
			console.log(MG.next())
			console.log(MG.next())
		</script>
	</body>
</html>
